#ifndef SIMPLEFOCCONTROLLER_H
#define SIMPLEFOCCONTROLLER_H

#include "basemodule.h"
#include "baseprotocol.h"
#include "basefindpacket.h"
#include "baseport.h"

class SimpleFOCController : public BaseModule
{
    Q_OBJECT
public:
    SimpleFOCController(QObject *parent = nullptr);
    virtual ~SimpleFOCController() override;
    
    virtual bool setConfig(int id, QVariant &var) override;
    virtual bool getConfig(int id, QVariant &var) override;

    void setPort(BasePort *port);
    BasePort *getPort(void);
    void setProtocol(BaseProtocol *protocol);
    BaseProtocol *getProtocol(void);

signals:
    void requestSend(const QByteArray &ba);

public slots:
    void onParse(QList<ProtocolPacket> packets);
    virtual void onStart() override;

private:
    BasePort *m_port = nullptr; // 该变量不常使用，因为通过信号槽连接了
    BaseProtocol *m_protocol = nullptr;
};

#endif // SIMPLEFOCCONTROLLER_H
